<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="format-detection" content="telephone=no" />
    <meta name="format-detection" content="email=no" />
    <title>首页</title>
    <link rel="stylesheet" href="../../css/api.css">


    <link rel="stylesheet" href="../../css/main.css">
    <link rel="stylesheet" href="../../css/vant.css">
    <!-- 引入样式 -->
    <style>
        .tab-title{
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
    </style>
</head>

<body>
    <div class="app" v-cloak>
        <div class="xiangqing">
            <div class="detail-header">
                <div class="header status-bar">
                    <span class="iconfont goback" @click="backPreviousPage">&#xe66f;</span>
                    <div class="tab-title">{{title}}</div>
                    <div class="opt-btn">
                        <div class="report-icon icon" @click="showDialog(1)"></div>
                        <div class="edit-icon icon" @click="showDialog(2)"></div>
                    </div>
                </div>
            </div>
        </div>
        <van-goods-action class="foot">
            <van-goods-action-icon color="#408CEC" icon="service-o" text="客服" @click="sendEvent('goIM')"></van-goods-action-icon>
            <van-goods-action-icon :color="isCollect?'#F53B31':'#408CEC'" :icon="isCollect?'star':'star-o'" text="收藏" @click="doCollect"></van-goods-action-icon>
            <div class="foot-btn">
                <van-button style="width:2.61rem" class="foot-call" round type="info"  @click="sendEvent('call')">立即联系</van-button>
            </div>
        </van-goods-action>
    </div>
    </div>
    <script src="../../script/api.js "></script>
    <script src="../../script/flexible.js "></script>
    <script src="../../script/fastclick.js "></script>
    <script src="../../script/vue.min.js "></script>
    <script src="../../script/iconfont.js "></script>
    <script src="../../script/vant.min.js"></script>
    <script src="../../script/common.js "></script>
    <script src="../../script/businessCommon.js "></script>
    <script src="../../script/restful.js "></script>
    <script>
        apiready = function() {
            var vm = new Vue({
                el: '.app',
                data() {
                    return {
                        module: 'INSURANCE',
                        id:'',
                        isCollect: false,
                        title:''
                    }
                },
                mounted() {
                    console.log(JSON.stringify(api.pageParam));
                    this.init()
                    this.openFrame()
                },
                methods: {
                    init(){
                        var vm = this
                        vm.title =  api.pageParam.item.companyName
                        vm.id = api.pageParam.item.id
                        // 初始化 收藏
                        checkHasCollect(vm.module, vm.id, vm)
                        // 添加浏览
                        addBrowse(vm.module, vm.id)
                    },
                    doCollect(){
                        handleCollect(vm.module, vm.id ,vm)
                    },
                    sendEvent(type){
                        if (!checkToken()) return false;
                        api.sendEvent({
                            name: 'sendFinanc',
                            extra: {type:type}
                        });
                    },
                    showDialog(type) {
                        if(!checkToken()) return false;
                        toReportOrShareDialog(vm.module, vm.id, type, vm.title)
                    },
                    openFrame(){
                        api.openFrame({
                            name: 'financinginsurance_detail_frm',
                            url: 'financinginsurance_detail_frm.html',
                            rect: {
                                marginTop: $api.fixStatusBar($api.dom('.detail-header')) + 4,
                                marginBottom: $api.fixTabBar($api.dom(".foot")),
                                w: 'auto'
                            },
                            pageParam: api.pageParam
                        })
                    },
                    backPreviousPage() {
                        api.closeWin();
                    }
                },

            })
        }
    </script>
</body>

</html>